// functionPage/pages/review/packageDetail/packageDetail.js
import Http from '../../../../utils/http.js';
const app = getApp();
const http = new Http();
import { getTimePart } from '../../../../utils/util.js';
Page({
    /**
     * 页面的初始数据
     */
    data: {
        review: '',
        id: '',
        item: {},
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.setData({
            review: options.review,
            id: options.id,
        });
        this.getPackageDetails(options.id);
    },

    getPackageDetails(id) {
        let data = {
            authId: app.globalData.authId,
            id,
        };
        http.getRequest('cjMap/getPackageDetails', data).then((res) => {
            if (res.status == 0) {
                let item = res.data;
                item.createtime = getTimePart(item.createtime).date;
                this.setData({
                    item,
                });
                wx.setNavigationBarTitle({
                    title: item.country,
                });
            }
        });
    },

    //打电话
    callPhone(e) {
        wx.makePhoneCall({
            phoneNumber: e.currentTarget.dataset.phone,
        });
    },
});
